package com.ice.work.moment.socket.dao.authorization;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.honeybee.cloud.framework.common.enums.DataStatusEnum;
import com.ice.work.moment.facade.socket.model.PushAuthorization;
import com.ice.work.moment.facade.socket.params.LoginParam;
import org.springframework.stereotype.Repository;

/**
 * @Description PushAuthorization dao
 * @Author DELL
 * @Create 2019-01-10
 * @Since 1.0.0
 */
@Repository
public class PushAuthorizationRepository extends ServiceImpl<IPushAuthorizationMapper, PushAuthorization> implements IPushAuthorizationRepository {


    @Override
    public PushAuthorization findByAccessKeyAndAccessSecretAndDeviceTypeAndDataStatus(LoginParam param) {
        return this.baseMapper.selectOne(new QueryWrapper<PushAuthorization>().lambda().eq(PushAuthorization::getAccessKey, param.getAccessKey())
                .eq(PushAuthorization::getAccessSecret, param.getAccessSecret()).eq(PushAuthorization::getDeviceType, param.getDeviceType()).eq(PushAuthorization::getDataStatus, DataStatusEnum.VALID.key));
    }
}


